<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="shortcut icon" href="../../favicon.ico"  type="image/x-icon"/>
	<link rel="stylesheet" href="../../layui/css/layui.css">
	<link rel="stylesheet" href="../../layui/css/admin.css">
	<link rel="stylesheet" href="../../layui/css/login.css">
</head>
<body>
    <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
        <div class="layadmin-user-login-main">
          <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>注册页暂未开发！！</h2>
            <p> </p>
          </div>
          <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
              <label class="layadmin-user-login-icon layui-icon layui-icon-cellphone" for="LAY-user-login-cellphone"></label>
              <input type="text" name="cellphone" id="LAY-user-login-cellphone" lay-verify="phone" placeholder="手机" class="layui-input">
            </div>
            <div class="layui-form-item">
              <div class="layui-row">
                <div class="layui-col-xs7">
                  <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                  <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="验证码" class="layui-input">
                </div>
                <div class="layui-col-xs5">
                  <div style="margin-left: 10px;">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-fluid" id="LAY-user-getsmscode">获取验证码</button>
                  </div>
                </div>
              </div>
            </div>
            <div class="layui-form-item">
              <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
              <input type="password" name="password" id="LAY-user-login-password" lay-verify="pass" placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
              <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-repass"></label>
              <input type="password" name="repass" id="LAY-user-login-repass" lay-verify="required" placeholder="确认密码" class="layui-input">
            </div>
            <div class="layui-form-item">
              <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-nickname"></label>
              <input type="text" name="nickname" id="LAY-user-login-nickname" lay-verify="nickname" placeholder="昵称" class="layui-input">
            </div>
            <div class="layui-form-item">
              <input type="checkbox" name="agreement" lay-skin="primary" title="同意用户协议" checked>
            </div>
            <div class="layui-form-item">
              <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-reg-submit">注 册</button>
            </div>
            <div class="layui-trans layui-form-item layadmin-user-login-other">
              <label>社交账号注册</label>
              <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
              <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
              <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
              
              <a href="login.html" class="layadmin-user-jump-change layadmin-link layui-hide-xs">用已有帐号登入</a>
            </div>
          </div>
        </div>
        
        <div class="layui-trans layadmin-user-login-footer">
          
          <p>© 欢迎进入llw的物联网之家 </p>
    
        </div>
    
      </div>
      <script src="../../layui/layui.all.js"></script>
      <script src="../../layui/layui.js"></script>
      <script src="../../layui/jquery-1.8.3.min.js"></script>
      <script src="../../js/core.util.js"></script>
      <!-- <script src="../../js/user/regis.js"></script> -->
<script>
    //Demo
layui.use('form', function(){
    var $ = layui.$
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form
    ,router = layui.router();

    form.render();
    
    //监听提交
    form.on('submit(LAY-user-reg-submit)', function(obj){
          var field = obj.field;
          
          //确认密码
          if(field.password !== field.repass){
            return layer.msg('两次密码输入不一致');
          }
          
          //是否同意用户协议
          if(!field.agreement){
            return layer.msg('你必须同意用户协议才能注册');
          }
          
        // CoreUtil.sendPost("http://localhost:8081/user/login")
        $.ajax({
            url: 'http://localhost:8081/user/register',
            data: {},
            type: 'post',
            dataType: "json",
            success: function (res) {
                if (res.code == 200) {
                    // window.location.href = "../../index.html"
                } else {
                    layer.msg(res.msg, { icon: 7 });
                
                }
            },
            error: function (err) {
                layer.msg("服务器好像除了点问题！请稍后试试", { icon: 7 });
            }
        })
          
          return false;
    });


});

</script>

    
</body>
</html>